/*
 * This source code is part of TWaver 4.0
 *
 * Serva Software PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 * Copyright 2002 - 2011 Serva Software. All rights reserved.
 */

package demo.network.topo.titlegroup;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Rectangle;

import twaver.TWaverConst;
import twaver.network.TNetwork;
import twaver.network.ui.GroupUI;

public class TitleGroupUI extends GroupUI {

	private TitleGroupLabelAttachment titleGroupLabelAttachment = null;
	
    public TitleGroupUI(TNetwork network, TitleGroup group) {
        super(network, group);
        this.titleGroupLabelAttachment = new TitleGroupLabelAttachment(this);
        this.setLabelAttachment(titleGroupLabelAttachment);
    }
    
    public void paint(Graphics2D g2d) {
    	super.paint(g2d);
    	if(this.getGroup().isSelected() && this.getGroup().isExpand()){
    		Rectangle rect = titleGroupLabelAttachment.getBounds();
    		rect = rect.union(this.getShape().getBounds());
    		g2d.setStroke(TWaverConst.BASIC_STROKE);
    		g2d.setColor(Color.red);
    		g2d.draw(rect);
    	}
    }
}